#ifndef BOARD_H
#define BOARD_H

#include "Cell.h"
#include "Direction.h"
#include <map>


class Board
{
public:
	Board();
	virtual ~Board();

	void Clear();
	void Resize(unsigned int width, unsigned int height);
	void Update(GameObject* object);
	Cell& CellAt(unsigned int cellX, unsigned int cellY) const;
	Cell& CellAt(GameObject* object) const;
	bool IsInsideBoard(unsigned int cellX, unsigned int cellY) const;
	bool IsInsideBoard(GameObject* object) const;

	Cell* ObjectNeighbourAt(GameObject* object, const Direction& direction) const;
	Cell* NeighbourAt(Cell& cell, const Direction& direction) const;

	// Test code
	void Print();

protected:
private:
	unsigned int CellCount() const;
	unsigned int Index(unsigned int cellX, unsigned int cellY) const;
	

	Cell* cells;
	unsigned int boardWidth;
	unsigned int boardHeight;

	std::map<GameObject*, Cell*> objectmap;
};

#endif //BOARD_H
